package ai.peanut.selfbase.common.domain;

/**
 * 系统公共状态码定义范围 :1001~2000
 * 
 * @author shenghua.hu
 */
public enum ErrorCode implements StatusDefinition {
	// 1001 ~1500 系统异常
	PART_ERROR(1000, ResultCode.BUSINESS_ERROR, "部分成功"), //
	OTHER_ERROR(1001, ResultCode.BUSINESS_ERROR, "其他错误"), // 其他/未知错误
	CALC_MD5_ERROR(1002, ResultCode.BUSINESS_ERROR, "calc MD5 error"), //
	SYSTEM_LIMITER(1003,ResultCode.BUSINESS_ERROR,  "系统限流保护"), //
	API_LIMITER(1004, ResultCode.BUSINESS_ERROR, "API限流保护"), //
	ILLEGAL_CONCURRENT_CALL(1005, ResultCode.BUSINESS_ERROR, "非法重复调用"), //
	TIME_OUT(1006,ResultCode.BUSINESS_ERROR, "系统超时"), //
	CONNECTION_TIME_OUT(1007, ResultCode.BUSINESS_ERROR, "连接超时"), //
	VERIFY_FAILED(1008, ResultCode.BUSINESS_ERROR, "验签失败"), //
	VERIFY_EXPIRE(1009, ResultCode.BUSINESS_ERROR, "签名已过期"), //
	UNZIP_FAILED(1010, ResultCode.BUSINESS_ERROR, "解压失败"), //
	ENCODER_FAILED(1011, ResultCode.BUSINESS_ERROR, "编码失败"), //
	DECODER_FAILED(1012, ResultCode.BUSINESS_ERROR, "解码失败"), //


	PARAM_ERROR(1500,ResultCode.BUSINESS_ERROR,  "参数错误"),
	// Request method 'POST|GET' not supported
	NOT_SUPPORT_METHOD(1501, ResultCode.BUSINESS_ERROR, "不支持的调用"), //
	NOT_SUPPORT_OPERATOR(1502, ResultCode.BUSINESS_ERROR, "不支持的操作"), //
	SERVER_REFUSE(1502, ResultCode.BUSINESS_ERROR, "服务拒绝"), //
	ILLEGAL_ARGUMENT(1503, ResultCode.BUSINESS_ERROR, "非法参数"), //
	JSON_SERIALIZE_FAIL(1504,ResultCode.BUSINESS_ERROR,  "json序列化失败"), //
	CONCURRENT_CACHE_KEY_TIMEOUT(1505, ResultCode.BUSINESS_ERROR,"concurrent cache key timeout"), // cache穿透并发超时
	PARAM_MISSING(1506, ResultCode.BUSINESS_ERROR,"缺少参数") ;//
	private int errorCode;
	private String resultCode;
	private String errorReason;

	public int getErrorCode() {
		return this.errorCode;
	}

	public String getResultCode(){
		return this.resultCode;
	}
	public String getErrorReason() {
		return this.errorReason;
	}

	private ErrorCode(int errorCode, String resultCode, String errorReason) {
		this.errorCode = errorCode;
		this.resultCode = resultCode;
		this.errorReason = errorReason;
	}

}
